home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / POLY-2D.DMO < prev    next >
Text File  |  1996-07-04  |  5KB  |  79 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-10-01 ╟─╖
  5.  │  │ FILE NAME   POLY-2D .DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16. $endif
  17.  
  18. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  19. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  20.                                             '┌────────────────────────────────
  21. $INCLUDE "DAS-NB01.INC"                     '│ ol ' N°1
  22. $INCLUDE "DAS-NB03.INC"                     '│ math package
  23. $INCLUDE "DAS-NBV1.INC"                     '│ VGA graphics
  24. $INCLUDE "PUBLICS .INC"                     '│ pick-up pPi# EXTERNAL
  25. CLS                                         '│
  26. SCREEN 12                                   '│
  27. GraphicSETUP                                '│ don 't forget this!
  28.                                             '│
  29. DIM tP1 AS PolygonTYPE                      '│ your basic hexagon
  30.  tP1.X        = 319                         '│  center column
  31.  tP1.Y        = 200                         '│  center row
  32.  tP1.Points   =   6                         '│  6 points = Hexagon
  33.  tP1.Radius   =  50                         '│  "circle" radius
  34.  tP1.Aspect   =   1                         '│  1 = normal aspect
  35.  tP1.StartDeg =   0                         '│  0 = point 1 at top
  36.  tP1.PMode    =   2                         '│  XOR poly ON/OFF
  37.  tP1.Colour   =  14                         '│  Yellow
  38.                                             '│
  39. '────────────────────────────────────────────┤ flickering Hexagon
  40.   H% = 1 : V% = 1                           '│ routine
  41.   DO                                        '│
  42.     INCR tP1.X, H%                          '│ new location
  43.     INCR tP1.Y, V%                          '│
  44.     IF tP1.Y =<  50 THEN V% =  1            '│ check boundries
  45.     IF tP1.Y => 420 THEN V% = -1            '│
  46.     IF tP1.X =<  50 THEN H% =  1            '│
  47.     IF tP1.X => 590 THEN H% = -1            '│
  48.     Draw2Dpolygon tP1                       '│ XOR on
  49.     Draw2Dpolygon tP1                       '│ XOR off
  50.   LOOP UNTIL INSTAT                         '│
  51.   G$ = INKEY$                               '│
  52. '────────────────────────────────────────────┤ flicker-free?
  53.   CLS                                       '│ it's all in the timing and
  54.   tP1.X = 319                               '│ speed of your system (try it)
  55.   tP1.Y = 200                               '│
  56.   DIM XY%(1,tP1.Points)                     '│ the point coordinates
  57.   H% = 3 : V% = 3                           '│ move values
  58.   GLineDRAW 0,245,639,245,0,3,14            '│ bounce line
  59.   GLineDRAW 0,145,639,145,0,3,15            '│ background line
  60.   DO                                        '│
  61.     PolygonPoints tP1, XY%()                '│ compute points
  62.     PolygonDRAW XY%(), tP1.Points, 0,2,11   '│ draw poly
  63.     INCR tP1.X, H%                          '│ move poly
  64.     INCR tP1.Y, V%                          '│
  65.     IF tP1.Y =<  50 THEN V% =  3            '│ check bounds
  66.     IF tP1.Y => 200 THEN V% = -3            '│
  67.     IF tP1.X =<  50 THEN H% =  3            '│
  68.     IF tP1.X => 590 THEN H% = -3            '│
  69.     GRFwaitRefresh 245                      '│
  70.     PolygonDRAW XY%(), tP1.Points, 0,2,11   '│ XOR poly off screen
  71.   LOOP UNTIL INSTAT                         '│ this routine is smooth as silk
  72.                                             '│ on my 486/40 but you may have
  73.                                             '│ to play with the numbers on
  74.                                             '│ yours as the MHz of the screen
  75. CLS                                         '│ is also a factor
  76. SCREEN 0                                    '└──────────────────────────────
  77.  
  78.  
  79.